// Generated from /Users/morandat/work/src/reactor-vmkit-merge/lib/Arithmetic.dispatch
template<typename OP>
Any* arithBinOperator(Any * left, Any * right) {
	llvm_gcroot(left, 0);
	llvm_gcroot(right, 0);

	int ltype = left->getType(left);
	int rtype = right->getType(right);
	if(ltype < rtype){
		swap(left, right);
		swap(ltype, rtype);
	}
	if(!Any::isOfType<Array>(left)) dispatchError(static_cast<Any*>(left), static_cast<Any*>(right));
	if(!Any::isOfType<Array>(right)) dispatchError(static_cast<Any*>(left), static_cast<Any*>(right));

	int pos = ((ltype&24)>>3) | ((rtype&24) >> (1));
	switch(pos){
		case 5:
			return arithBinOperatorImpl<OP, Int, Int>(static_cast<Int*>(left), static_cast<Int*>(right));
		case 9:
			return arithBinOperatorImpl<OP, Double, Int>(static_cast<Double*>(left), static_cast<Int*>(right));
		case 10:
			return arithBinOperatorImpl<OP, Double, Double>(static_cast<Double*>(left), static_cast<Double*>(right));
		default: dispatchError(static_cast<Any*>(left), static_cast<Any*>(right));
			return 0;
	};
}
